﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DeansWsccProject._Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="cc1" %>

<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                <h1>Top Rated eBooks</h1>
                </hgroup>
    <asp:ListView ID="highestRatedEBooksListView" runat="server" DataSourceID="highestRatedEBooksSqlDataSource" GroupItemCount="3" OnSelectedIndexChanged="highestRatedEBooksListView_SelectedIndexChanged">
        <AlternatingItemTemplate>
            <td runat="server" style="">
                <center>
                <a href='/details.aspx?ID=<%# Eval("eBook_fkid") %>'><img class="eBookImage" src='/<%# Eval("eBookImage") %>' alt="Image Unvailable" /></a>
                <br />
                <a href='/details.aspx?ID=<%# Eval("eBook_fkid") %>'><%# Eval("eBookTitle") %></a>
                <br />
                Current Rating: <%# Convert.ToString(Eval("eBookRating")).Insert(1, ".") %>/10 (<a href='/details.aspx?ID=<%# Eval("eBook_fkid") %>#recent-reviews'><%# Eval("noReviews") %> Reviews</a>)
                </center>
            </td>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <td runat="server" style="">eBook_fkid:
                <asp:TextBox ID="eBook_fkidTextBox" runat="server" Text='<%# Bind("eBook_fkid") %>' />
                <br />eBookTitle:
                <asp:TextBox ID="eBookTitleTextBox" runat="server" Text='<%# Bind("eBookTitle") %>' />
                <br />eBookImage:
                <asp:TextBox ID="eBookImageTextBox" runat="server" Text='<%# Bind("eBookImage") %>' />
                <br />avgRating:
                <asp:TextBox ID="avgRatingTextBox" runat="server" Text='<%# Bind("avgRating") %>' />
                <br />noReviews:
                <asp:TextBox ID="noReviewsTextBox" runat="server" Text='<%# Bind("noReviews") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
                <br />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                <br /></td>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" style="">
                <tr>
                    <td>No data was returned.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <EmptyItemTemplate>
<td runat="server" />
        </EmptyItemTemplate>
        <GroupTemplate>
            <tr id="itemPlaceholderContainer" runat="server">
                <td id="itemPlaceholder" runat="server"></td>
            </tr>
        </GroupTemplate>
        <InsertItemTemplate>
            <td runat="server" style="">eBook_fkid:
                <asp:TextBox ID="eBook_fkidTextBox" runat="server" Text='<%# Bind("eBook_fkid") %>' />
                <br />eBookTitle:
                <asp:TextBox ID="eBookTitleTextBox" runat="server" Text='<%# Bind("eBookTitle") %>' />
                <br />eBookImage:
                <asp:TextBox ID="eBookImageTextBox" runat="server" Text='<%# Bind("eBookImage") %>' />
                <br />avgRating:
                <asp:TextBox ID="avgRatingTextBox" runat="server" Text='<%# Bind("avgRating") %>' />
                <br />noReviews:
                <asp:TextBox ID="noReviewsTextBox" runat="server" Text='<%# Bind("noReviews") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
                <br />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
                <br /></td>
        </InsertItemTemplate>
        <ItemTemplate>
            <td runat="server" style="">
                <center>
                <a href='/details.aspx?ID=<%# Eval("eBook_fkid") %>'><img class="eBookImage" src='/<%# Eval("eBookImage") %>' alt="Image Unvailable" /></a>
                <br />
                <a href='/details.aspx?ID=<%# Eval("eBook_fkid") %>'><%# Eval("eBookTitle") %></a>
                <br />
                Current Rating: <%# Convert.ToString(Eval("eBookRating")).Insert(1, ".") %>/10 (<a href='/details.aspx?ID=<%# Eval("eBook_fkid") %>#recent-reviews'><%# Eval("noReviews") %> Reviews</a>)
                </center>
            </td>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table id="groupPlaceholderContainer" runat="server" border="0" style="">
                            <tr id="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" style="">
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <td runat="server" style="">eBook_fkid:
                <asp:Label ID="eBook_fkidLabel" runat="server" Text='<%# Eval("eBook_fkid") %>' />
                <br />eBookTitle:
                <asp:Label ID="eBookTitleLabel" runat="server" Text='<%# Eval("eBookTitle") %>' />
                <br />eBookImage:
                <asp:Label ID="eBookImageLabel" runat="server" Text='<%# Eval("eBookImage") %>' />
                <br />avgRating:
                <asp:Label ID="avgRatingLabel" runat="server" Text='<%# Eval("avgRating") %>' />
                <br />noReviews:
                <asp:Label ID="noReviewsLabel" runat="server" Text='<%# Eval("noReviews") %>' />
                <br /></td>
        </SelectedItemTemplate>
            </asp:ListView>
    <asp:SqlDataSource ID="highestRatedEBooksSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:DeansWsccProjectConnectionString %>" ProviderName="<%$ ConnectionStrings:DeansWsccProjectConnectionString.ProviderName %>" SelectCommand="SELECT [eBook_fkid], [noReviews], [eBookTitle], [eBookImage], [eBookRating] FROM [eBookAverageRatings] WHERE ([noReviews] &gt;= ?) ORDER BY [avgRating] DESC, [eBookTitle]">
        <SelectParameters>
            <asp:Parameter DefaultValue="5" Name="noReviews" Type="Int32" />
        </SelectParameters>
            </asp:SqlDataSource>

            <hgroup class="title">
                <h1>New Releases</h1>
                </hgroup>
            <asp:ListView ID="newlyReleasedEBooksListView" runat="server" DataSourceID="newlyReleasedEBooksSqlDataSource" DataKeyNames="ID" GroupItemCount="3">
                <AlternatingItemTemplate>
                    <td runat="server" style="">
                        <center>
                            <a href='/details.aspx?ID=<%# Eval("ID") %>'><img class="eBookImage" src='/<%# Eval("eBookImage") %>' alt="Image Unvailable" /></a>
                            <br />
                            <a href='/details.aspx?ID=<%# Eval("ID") %>'><%# Eval("eBookTitle") %></a>
                            <br />
                            Released: <%# Convert.ToString(Eval("eBookReleaseDate")).Remove(10, 9) %>
                        </center>
                    </td>
                </AlternatingItemTemplate>
                <EditItemTemplate>
                    <td runat="server" style="">ID:
                        <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                        <br />eBookTitle:
                        <asp:TextBox ID="eBookTitleTextBox" runat="server" Text='<%# Bind("eBookTitle") %>' />
                        <br />eBookImage:
                        <asp:TextBox ID="eBookImageTextBox" runat="server" Text='<%# Bind("eBookImage") %>' />
                        <br />eBookReleaseDate:
                        <asp:TextBox ID="eBookReleaseDateTextBox" runat="server" Text='<%# Bind("eBookReleaseDate") %>' />
                        <br />
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
                        <br />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                        <br /></td>
                </EditItemTemplate>
                <EmptyDataTemplate>
                    <table runat="server" style="">
                        <tr>
                            <td>No data was returned.</td>
                        </tr>
                    </table>
                </EmptyDataTemplate>
                <EmptyItemTemplate>
<td runat="server" />
                </EmptyItemTemplate>
                <GroupTemplate>
                    <tr id="itemPlaceholderContainer" runat="server">
                        <td id="itemPlaceholder" runat="server"></td>
                    </tr>
                </GroupTemplate>
                <InsertItemTemplate>
                    <td runat="server" style="">eBookTitle:
                        <asp:TextBox ID="eBookTitleTextBox" runat="server" Text='<%# Bind("eBookTitle") %>' />
                        <br />eBookImage:
                        <asp:TextBox ID="eBookImageTextBox" runat="server" Text='<%# Bind("eBookImage") %>' />
                        <br />eBookReleaseDate:
                        <asp:TextBox ID="eBookReleaseDateTextBox" runat="server" Text='<%# Bind("eBookReleaseDate") %>' />
                        <br />
                        <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
                        <br />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
                        <br /></td>
                </InsertItemTemplate>
                <ItemTemplate>
                    <td runat="server" style="">
                        <center>
                            <a href='/details.aspx?ID=<%# Eval("ID") %>'><img class="eBookImage" src='/<%# Eval("eBookImage") %>' alt="Image Unvailable" /></a>
                            <br />
                            <a href='/details.aspx?ID=<%# Eval("ID") %>'><%# Eval("eBookTitle") %></a>
                            <br />
                            Released: <%# Convert.ToString(Eval("eBookReleaseDate")).Remove(10, 9) %>
                        </center>
                    </td>
                </ItemTemplate>
                <LayoutTemplate>
                    <table runat="server">
                        <tr runat="server">
                            <td runat="server">
                                <table id="groupPlaceholderContainer" runat="server" border="0" style="">
                                    <tr id="groupPlaceholder" runat="server">
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr runat="server">
                            <td runat="server" style=""></td>
                        </tr>
                    </table>
                </LayoutTemplate>
                <SelectedItemTemplate>
                    <td runat="server" style="">ID:
                        <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                        <br />eBookTitle:
                        <asp:Label ID="eBookTitleLabel" runat="server" Text='<%# Eval("eBookTitle") %>' />
                        <br />eBookImage:
                        <asp:Label ID="eBookImageLabel" runat="server" Text='<%# Eval("eBookImage") %>' />
                        <br />eBookReleaseDate:
                        <asp:Label ID="eBookReleaseDateLabel" runat="server" Text='<%# Eval("eBookReleaseDate") %>' />
                        <br /></td>
                </SelectedItemTemplate>
            </asp:ListView>
            <asp:SqlDataSource ID="newlyReleasedEBooksSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:DeansWsccProjectConnectionString %>" ProviderName="<%$ ConnectionStrings:DeansWsccProjectConnectionString.ProviderName %>" SelectCommand="SELECT [ID], [eBookTitle], [eBookImage], [eBookReleaseDate] FROM [eBooks] ORDER BY [eBookReleaseDate] DESC, [eBookTitle]"></asp:SqlDataSource>
        </div>
    </section>
</asp:Content>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">

</asp:Content>
